]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-private: Scale shadows accordingly to actor resource scaling
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Sat, 2 Sep 2017 02:08:55 +0000 (04:08 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 1 Mar 2019 17:12:52 +0000 (17:12 +0000)
Use scaled offscreen framebuffer to paint shadows so that it will match the
scaling applied to the actual actor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=765011

src/st/st-private.c

index aa1e42462a29961b811dc2a9ff3745f121e7ce38..c9bcf4c3af5d4dc1303a0e4f12a88119a77ebe0d 100644 (file)
@@ -431,6 +431,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
 {
   ClutterContent *image = NULL;
   CoglPipeline *shadow_pipeline = NULL;
+  float resource_scale;
   float width, height;
 
   g_return_val_if_fail (clutter_actor_has_allocation (actor), NULL);
@@ -440,6 +441,12 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
   if (width == 0 || height == 0)
     return NULL;
 
+  if (!clutter_actor_get_resource_scale (actor, &resource_scale))
+    return NULL;
+
+  width *= resource_scale;
+  height *= resource_scale;
+
   image = clutter_actor_get_content (actor);
   if (image && CLUTTER_IS_IMAGE (image))
     {
@@ -491,6 +498,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       cogl_framebuffer_clear (fb, COGL_BUFFER_BIT_COLOR, &clear_color);
       cogl_framebuffer_translate (fb, -x, -y, 0);
       cogl_framebuffer_orthographic (fb, 0, 0, width, height, 0, 1.0);
+      cogl_framebuffer_scale (fb, resource_scale, resource_scale, 1);
 
       clutter_actor_set_opacity_override (actor, 255);
       clutter_actor_paint (actor);